package demo3;

public class Test {
    public static void main(String[] args)
            throws CloneNotSupportedException{
        Person person1 = new Person(10,"zhangsan");
        //我想克隆一个Person应该怎么做呢？
        // clone
        Person person2 = (Person) person1.clone();
        //自定义的类型如果想要被克隆,必须得实现一个接口
        System.out.println("修改前："+person1.m.money);
        System.out.println("修改后："+person2.m.money);

        person2.m.money=99.99;
        System.out.println("修改前："+person1.m.money);
        System.out.println("修改后："+person2.m.money);
    }
}
